Skip to content

Conversation

@rbtr
Copy link
Collaborator

@rbtr rbtr commented Apr 30, 2025

We only really need an ongoing connection to k8s if we are in dynamic podsubnet mode. Overlay and vnetblock are static and do not need it after initialization, so we shouldn't consider loss of apiserver connectivity a restartable failure in those scenarios.

Copilot AI review requested due to automatic review settings April 30, 2025 17:24
@rbtr rbtr requested a review from a team as a code owner April 30, 2025 17:24
@rbtr rbtr requested a review from paulyufan2 April 30, 2025 17:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the healthz handler to only include Kubernetes API server connectivity checks in dynamic podsubnet mode, reducing unnecessary checks in static modes. Key changes include:

  • Modifying the main service to conditionally enable the API server ping based on the podsubnet mode.
  • Updating tests to reflect the new Config struct in the healthz package.
  • Refactoring the healthz handler to use a new configuration structure with a single PingAPIServer flag.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
cns/service/main.go Updated healthz handler initialization to use conditional API ping.
cns/healthserver/healthz_test.go Updated tests to use the new Config struct with the PingAPIServer flag.
cns/healthserver/healthz.go Refactored the NewHealthzHandlerWithChecks function to use the new config.
Comments suppressed due to low confidence (2)

cns/healthserver/healthz.go:22

  • [nitpick] The new struct name 'Config' is quite generic; consider renaming it to 'HealthzConfig' to provide clearer context.
type Config struct {

cns/healthserver/healthz.go:30

  • Avoid shadowing the input 'cfg' by using a different variable name (e.g., 'kubeCfg') when obtaining the kubeconfig to improve code clarity.
cfg, err := ctrl.GetConfig()

@rbtr
Copy link
Collaborator Author

rbtr commented Apr 30, 2025

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@rbtr rbtr force-pushed the fix/healthz-ping-podsubnet branch 2 times, most recently from 7fef88b to 35c0c96 Compare April 30, 2025 17:27
@rbtr rbtr requested a review from a team as a code owner April 30, 2025 17:35
@rbtr rbtr force-pushed the fix/healthz-ping-podsubnet branch from 4290f92 to 43a0746 Compare April 30, 2025 17:35
@rbtr
Copy link
Collaborator Author

rbtr commented Apr 30, 2025

/azp run Azure Container Networking PR

@rbtr rbtr enabled auto-merge April 30, 2025 17:36
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: GitHub <[email protected]>
@rbtr rbtr force-pushed the fix/healthz-ping-podsubnet branch from 43a0746 to 6e3ad3d Compare April 30, 2025 21:20
@rbtr
Copy link
Collaborator Author

rbtr commented May 1, 2025

/azp run Azure Container Networking PR

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@rbtr rbtr disabled auto-merge May 2, 2025 00:23
@rbtr rbtr added this pull request to the merge queue May 2, 2025
Merged via the queue into master with commit 0545b71 May 2, 2025
16 checks passed
@rbtr rbtr deleted the fix/healthz-ping-podsubnet branch May 2, 2025 02:34
sivakami-projects pushed a commit that referenced this pull request Oct 23, 2025
* fix: only ping k8s for healthz in podsubnet

Signed-off-by: GitHub <[email protected]>

* update dockerfiles

Signed-off-by: GitHub <[email protected]>

---------

Signed-off-by: GitHub <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants